package com.dixon.worddayday.response;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class BaseRes<T> {
    private String code = "100";
    private String desc = "OK";

    private T data;

    public BaseRes() {
    }

    public BaseRes(T data) {
        this.data = data;
    }

    public BaseRes(String code, String desc, T data) {
        this.code = code;
        this.desc = desc;
        this.data = data;
    }

    public static BaseRes success() {
        return BaseRes.builder().code("100").desc("OK").build();
    }

    public static BaseRes failure() {
        return BaseRes.builder().code("0001").desc("失败").build();
    }
}
